package lab03.test04;

import java.io.BufferedWriter;
import java.io.*;
    public class Test {
        public static void main(String[] args) {
            String source = "D:\\source\\high.mp3";
            String target = "D:\\target\\";
            BufferedWriter writer = null;
            BufferedReader reader = null;
            try {

                reader = new BufferedReader(new FileReader(source));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            try {

                File file = new File(target);
                if (!file.exists()) file.mkdir();
                try {
                    writer = new BufferedWriter(new FileWriter("D:\\target\\high.mp3"));
                } catch (IOException e) {
                    e.printStackTrace();

                }
                try {
                    writer.write(reader.read());
                } catch (IOException e) {
                    e.printStackTrace();

                }
                for (File f : file.listFiles()) {
                    if (f.isFile()) {
                        System.out.println("文件：" + f.getName());
                    }
                }

            }finally {
                try {

                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

